/**
 * Created by zoushuiyun on 2017/8/23
 */
import {Component, Inject, OnInit} from '@angular/core';
import {MD_DIALOG_DATA, MdDialogRef} from '@angular/material';
import {fadeInAnimation} from "../../routing/route.animation";

@Component({
  selector: 'my-tip',
  template: `<div class="alert-box" (click)="ok()">
                <div class="info-box" [style.background-color]="backgroundColor" >
                    <h3>{{tipText}}</h3>
                </div>
            </div>`,
  styles:[`
          .alert-box{width: 100%;height: 100%;}
          .info-box{width: 220px;height: auto;border-radius:10px;opacity:0.8; margin: 0 auto;margin-top: 190px;padding-top: 30px;padding-bottom: 30px;   position: fixed;top: 0;left: 50%;margin-left: -110px;z-index: 10001;}
          .info-box h3{line-height: 16px;color: #fff;font-size: 16px;text-align: center;font-weight: normal; padding: 0 30px;}`
        ],
  host: {
    '[@fadeInAnimation]': 'true'
  },
  animations: [ fadeInAnimation ]
})
export class PlaintextComponent  implements OnInit {

  tipText:any="";
  config:any=[];
  backgroundColor:any = "#000";
  constructor(public dialogRef: MdDialogRef<PlaintextComponent>,@Inject(MD_DIALOG_DATA) data: any) {
    this.config = data
  }
  ngOnInit() {
    this.tipText = this.config.tipText;
    this.backgroundColor = this.config.backgroundColor?this.config.backgroundColor:"#000";
    setTimeout(()=>{this.ok()},1500)
  }

  ok() {
    this.dialogRef.close({status:false})
  }

}
